/*
 * This is the observable subject in the observer pattern. It is simlar to the java Observable but it accepts String instead of Object and it expects the I_Observer for some params
 */
package cosc617_blackteam;

import java.util.ArrayList;

/**
 *
 * @author Anton
 */
class ObSubject {

    private ArrayList<I_Observer> obs;

    public ObSubject() {
        this.obs = new ArrayList<>();
    }

    public void attach(I_Observer ob) {
        this.obs.add(ob);
    }

    public void detach(I_Observer ob) {
        this.obs.remove(ob);
    }

    public void notifyObservers(String arg) {
        for (I_Observer ob : obs) {
            ob.update(this, arg);
        }

    }
}
